#!/bin/bash
##Install Go Lang in CentOS 7 machines.
#Installing imp packages
yum install wget unzip -y
##Donwloading Go Package
#wget -O /opt/go1.9.1.linux-amd64.tar.gz https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz
echo "#####################################################################"
echo 'use the lastest .gz'
echo 'exp: go1.12.12.linux-amd64.tar.gz'
pwd
echo "This File is "$1

echo "#####################################################################"
wget -O /opt/$1 https://storage.googleapis.com/golang/$1
##Extract packages to a location
tar -C /usr/local -xzf /opt/$1
##Export Variable path

echo "export GOPATH=$PATH:/home/gopath" >>/etc/profile
echo "export PATH=$PATH:/usr/local/go/bin" >>/etc/profile
source /etc/profile

##Installation completed.
clear
echo "GoLang has been installed succesfully"
sleep 2s
clear
echo "You must need to logout and login again to complete the Installation"
echo "#####################################################################"

echo "Installation path is /usr/local/go"
